home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / POV-Ray 3.0.2 / src / SOURCE / OBJECTS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-25  |  6.1 KB  |  150 lines  |  [TEXT/CWIE]

  1. /****************************************************************************
  2. *                   objects.h
  3. *
  4. *  This module contains all defines, typedefs, and prototypes for OBJECTS.C.
  5. *
  6. *  from Persistence of Vision(tm) Ray Tracer
  7. *  Copyright 1996 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. *  NOTICE: This source code file is provided so that users may experiment
  10. *  with enhancements to POV-Ray and to port the software to platforms other
  11. *  than those supported by the POV-Ray Team.  There are strict rules under
  12. *  which you are permitted to use this file.  The rules are in the file
  13. *  named POVLEGAL.DOC which should be distributed with this file. If
  14. *  POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. *  Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  16. *  Forum.  The latest version of POV-Ray may be found there as well.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23.  
  24. /* NOTE: FRAME.H contains other object stuff. */
  25.  
  26. #ifndef OBJECTS_H
  27. #define OBJECTS_H
  28.  
  29.  
  30.  
  31. /*****************************************************************************
  32. * Global preprocessor defines
  33. ******************************************************************************/
  34.  
  35. /*
  36.  * [DB 7/94]
  37.  *
  38.  * The flag field is used to store all possible flags that are
  39.  * used for objects (up to 16).
  40.  *
  41.  * The flages are manipulated using the following macros:
  42.  *
  43.  *   Set_Flag    (Object, Flag) : set    specified Flag in Object
  44.  *   Clear_Flag  (Object, Flag) : clear  specified Flag in Object
  45.  *   Invert_Flag (Object, Flag) : invert specified Flag in Object
  46.  *   Test_Flag   (Object, Flag) : test   specified Flag in Object
  47.  *
  48.  *   Copy_Flag   (Object1, Object2, Flag) : Set the Flag in Object1 to the
  49.  *                                          value of the Flag in Object2.
  50.  *   Bool_Flag   (Object, Flag, Bool)     : if(Bool) Set flag else Clear flag
  51.  *
  52.  * Object is a pointer to the object.
  53.  * Flag is the number of the flag to test.
  54.  *
  55.  */
  56.  
  57. #define NO_SHADOW_FLAG    0x0001 /* Object doesn't cast shadows            */
  58. #define CLOSED_FLAG       0x0002 /* Object is closed                       */
  59. #define INVERTED_FLAG     0x0004 /* Object is inverted                     */
  60. #define SMOOTHED_FLAG     0x0008 /* Object is smoothed                     */
  61. #define CYLINDER_FLAG     0x0010 /* Object is a cylinder                   */
  62. #define DEGENERATE_FLAG   0x0020 /* Object is degenerate                   */
  63. #define STURM_FLAG        0x0040 /* Object should use sturmian root solver */
  64. #define OPAQUE_FLAG       0x0080 /* Object is opaque                       */
  65. #define MULTITEXTURE_FLAG 0x0100 /* Object is multi-textured               */
  66. #define INFINITE_FLAG     0x0200 /* Object is infinite                     */
  67. #define HIERARCHY_FLAG    0x0400 /* Object can have a bounding hierarchy   */
  68. #define HOLLOW_FLAG       0x0800 /* Object is hollow (atmosphere inside)   */
  69. #define HOLLOW_SET_FLAG   0x1000 /* Hollow explicitly set in scene file    */
  70.  
  71. #define Set_Flag(Object, Flag)     \
  72.   { (Object)->Flags |=  (Flag); }
  73.  
  74. #define Clear_Flag(Object, Flag)   \
  75.   { (Object)->Flags &= ~(Flag); }
  76.  
  77. #define Invert_Flag(Object, Flag)  \
  78.   { (Object)->Flags ^=  (Flag); }
  79.  
  80. #define Test_Flag(Object, Flag)    \
  81.   ((Object)->Flags & (Flag))
  82.  
  83. #define Copy_Flag(Object1, Object2, Flag) \
  84.   { (Object1)->Flags = (((Object1)->Flags) & (!Flag)) | \
  85.                        (((Object2)->Flags) &  (Flag)); }
  86.  
  87. #define Bool_Flag(Object1, Flag, Bool) \
  88.   { if(Bool){ (Object)->Flags |=  (Flag); } else { (Object)->Flags &= ~(Flag); }}
  89.  
  90.  
  91.  
  92. /* Object types. */
  93.  
  94. #define BASIC_OBJECT            0
  95. #define PATCH_OBJECT            1 /* Has no inside, no inverse */
  96. #define TEXTURED_OBJECT         2 /* Has texture, possibly in children */
  97. #define COMPOUND_OBJECT         4 /* Has children field */
  98. #define STURM_OK_OBJECT         8 /* STRUM legal */
  99. #define WATER_LEVEL_OK_OBJECT  16 /* WATER_LEVEL legal */
  100. #define LIGHT_SOURCE_OBJECT    32 /* link me in frame.light_sources */
  101. #define BOUNDING_OBJECT        64 /* This is a holder for bounded object */
  102. #define SMOOTH_OK_OBJECT      128 /* SMOOTH legal */
  103. #define IS_CHILD_OBJECT       256 /* Object is inside a COMPOUND */
  104. #define DOUBLE_ILLUMINATE     512 /* Illuminate both sides of surface to avoid normal purturb bug */
  105. #define HIERARCHY_OK_OBJECT  1024 /* NO_HIERARCHY legal */
  106.  
  107. #define CHILDREN_FLAGS (PATCH_OBJECT+TEXTURED_OBJECT)  /* Reverse inherited flags */
  108.  
  109.  
  110.  
  111. /*****************************************************************************
  112. * Global typedefs
  113. ******************************************************************************/
  114.  
  115.  
  116.  
  117. /*****************************************************************************
  118. * Global variables
  119. ******************************************************************************/
  120.  
  121. extern unsigned int Number_of_istacks;
  122. extern unsigned int Max_Intersections;
  123. extern ISTACK *free_istack;
  124.  
  125.  
  126.  
  127. /*****************************************************************************
  128. * Global functions
  129. ******************************************************************************/
  130.  
  131. int Intersection PARAMS((INTERSECTION *Ray_Intersection, OBJECT *Object, RAY *Ray));
  132. int Ray_In_Bound PARAMS((RAY *Ray, OBJECT *Bounding_Object));
  133. int Point_In_Clip PARAMS((VECTOR IPoint, OBJECT *Clip));
  134. OBJECT *Copy_Object PARAMS((OBJECT *Old));
  135. void Translate_Object PARAMS((OBJECT *Object, VECTOR Vector, TRANSFORM *Trans));
  136. void Rotate_Object PARAMS((OBJECT *Object, VECTOR Vector, TRANSFORM *Trans));
  137. void Scale_Object PARAMS((OBJECT *Object, VECTOR Vector, TRANSFORM *Trans));
  138. void Transform_Object PARAMS((OBJECT *Object, TRANSFORM *Trans));
  139. int Inside_Object PARAMS((VECTOR IPoint, OBJECT *Vector));
  140. void Invert_Object PARAMS((OBJECT *Object));
  141. void Destroy_Object PARAMS((OBJECT *Object));
  142. ISTACK *open_istack PARAMS((void));
  143. void close_istack PARAMS((ISTACK *istk));
  144. void incstack PARAMS((ISTACK *istk));
  145. void Destroy_IStacks PARAMS((void));
  146.  
  147.  
  148.  
  149. #endif
  150.